<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="/resource/UserPwoer.tld" prefix="p"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	pageContext.setAttribute("fnId", request.getAttribute("fnId"));
	pageContext.setAttribute("userPwoer", request.getSession().getAttribute("userPwoer"));
%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<!-- 导出  -->
<script type="text/javascript"
	src="${path }/resource/plugin/ajaxfileupload.js"></script>
<style>
.ibox-content {
	position: relative
}

.money {
	position: absolute;
	bottom: 37px;
	right: 110px;
}
</style>
</head>
<body class="gray-bg">
	<nav class="huiNav">
		<i class="fa fa-home"></i> 首页 <span>&gt;</span>付款管理<span>&gt;</span>费用登记
		<a class="btn btn-info  btn-sm pull-right"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="fa fa-refresh"></i></a>
	</nav>

	<!-- 显示tab选项 -->
	<div class="row">
		<div class="col-sm-12">
			<ul class="nav nav-tabs">
				<li class="active"><a data-toggle="tab" href="#tab-1"
					aria-expanded="true">班级费用登记</a></li>
				<li class=""><a data-toggle="tab" href="#tab-2"
					aria-expanded="false">校院费用登记</a></li>
				<li class=""><a data-toggle="tab" href="#tab-3"
					aria-expanded="false">个人费用登记</a></li>
			</ul>
			<div class="tab-content">
				<div id="tab-1" class="tab-pane active">
					<div class="panel-body">
						<!-- 选项卡内容 begin -->
						<div class="ibox-content">
							<!-- 搜索框部分start -->
							<p:btn value="serch">
								<form class="form-inline" id="serchform1">
									<label for="exampleInputName2">班级</label>
									<div class="form-group mr-20">
										<div style="width: 160px;">
											<select name="claId" id="sClass"
												class="form-control autoFull select2"
												data-url="${path}/admin/tabClass/showAllClass"
												data-filed="claName" data-value="claId">
												<option value="">--请选择所在班级--</option>
											</select>
										</div>
									</div>

									<div class="form-group mr-20 ">
										<label for="exampleInputName2">费用名目</label> <input
											class="form-control" name="ctItems" type="text">
									</div>

									<div class="form-group mr-20 ">
										<label for="exampleInputName2">领款人</label> <input
											class="form-control" name="ctPayee" type="text">
									</div>

									<label for="exampleInputName2">领款部门</label>
									<div class="form-group mr-20">
										<select name="ctDept" class="form-control autoFull select2"
											data-url="${path}/admin/userinfo/queryAllDepart"
											data-def="${obj.ctDept }" data-filed="name" data-value="name"
											datatype="*" nullmsg="部门不能为空">
											<option value="">--请选择所属部门--</option>
										</select>
										<div class="Validform_checktip"></div>
									</div>

									<br />
									<br />

									<div class="form-group mr-20">
										<label for="exampleInputName2">入学时间</label> <input
											name="beginTime" id="beginTime" type="text"
											class="form-control datetimepicker">— <input
											name="endTime" id="endTime" type="text"
											class="form-control datetimepicker">
									</div>

									<button onclick="myGrid.serchData()" type="button"
										class="btn btn-info btn-sm">
										<i class="fa fa-search "></i> 搜索
									</button>
									<button type="button" onclick="MForm.reset('#serchform1')"
										class="btn btn-info btn-sm">
										<i class="fa fa-refresh "></i> 重置
									</button>
								</form>
							</p:btn>
							<!-- 搜索框部分en -->
							<div class="option-bar">
								<p:btn value="dels">
									<button onclick="myGrid.delItems('ctId')" type="button"
										class="btn btn-danger btn-sm">
										<i class="fa fa-trash"></i>批量删除
									</button>
								</p:btn>
								<p:btn value="add">
									<button onclick="openAdd()" type="button"
										class="btn btn-success btn-sm">
										<i class="fa fa-plus"></i> 新增
									</button>
								</p:btn>
							</div>

							<table id="mgrid1" data-url="">
								<thead>
									<tr>
										<th data-checkbox="true"></th>
										<th data-formatter="MGrid.indexfn" data-align="center"
											data-width="30px">序号</th>
										<th data-field="claName">班级</th>
										<th data-field="claNum">班级人数</th>
										<th data-field="avgCla">班级个人费用</th>
										<th data-field="ctItems">费用名目</th>
										<th data-field="ctMoney">费用金额</th>
										<th data-field="ctDate" data-formatter="MGrid.getTimeDD">领款日期</th>
										<th data-field="ctPayee">领款人</th>
										<th data-field="ctDept">领款部门</th>
										<th data-field="ctRemark">备注</th>
										<th data-align="center" data-width="180px" data-field="ctId"
											data-formatter="buidOperate">操作</th>
									</tr>
								</thead>
							</table>
						</div>
						<!-- 选项卡内容 end -->
					</div>
				</div>

				<!-- 这是第二个选项卡的内容 -->
				<div id="tab-2" class="tab-pane">
					<div class="panel-body">
						<!-- 选项卡内容 end -->
						<div class="ibox-content">
							<!-- 搜索框部分start -->
							<p:btn value="serch">
								<form class="form-inline" id="serchform2">

									<label for="exampleInputName2">院校</label>
									<div class="form-group mr-20">
										<div style="width: 160px;">
											<select name=ctSchool class="form-control autoFull select2"
												data-url="${path}/admin/studentinfo/showAllSchool"
												data-def="${obj.ctSchool }" data-filed="name"
												data-value="name">
												<option value="">--请选择所在学校--</option>
											</select>
										</div>
									</div>

									<div class="form-group mr-20 ">
										<label for="exampleInputName2">费用名目</label> <input
											class="form-control" name="ctItems" type="text">
									</div>

									<div class="form-group mr-20 ">
										<label for="exampleInputName2">领款人</label> <input
											class="form-control" name="ctPayee" type="text">
									</div>

									<label for="exampleInputName2">领款部门</label>
									<div class="form-group mr-20">
										<select name="ctDept" class="form-control autoFull select2"
											data-url="${path}/admin/userinfo/queryAllDepart"
											data-def="${obj.ctDept }" data-filed="name" data-value="name"
											datatype="*" nullmsg="部门不能为空">
											<option value="">--请选择所属部门--</option>
										</select>
										<div class="Validform_checktip"></div>
									</div>

									<br />
									<br />

									<div class="form-group mr-20">
										<label for="exampleInputName2">入学时间</label> <input
											name="beginTime" id="beginTime" type="text"
											class="form-control datetimepicker">— <input
											name="endTime" id="endTime" type="text"
											class="form-control datetimepicker">
									</div>


									<button onclick="myGrid2.serchData()" type="button"
										class="btn btn-info btn-sm">
										<i class="fa fa-search "></i> 搜索
									</button>
									<button type="button" onclick="MForm.reset('#serchform2')"
										class="btn btn-info btn-sm">
										<i class="fa fa-refresh "></i> 重置
									</button>
								</form>
							</p:btn>
							<!-- 搜索框部分en -->
							<div class="option-bar">
								<p:btn value="dels">
									<button onclick="myGrid2.delItems('ctId')" type="button"
										class="btn btn-danger btn-sm">
										<i class="fa fa-trash"></i>批量删除
									</button>
								</p:btn>
								<p:btn value="add">
									<button onclick="openAdd()" type="button"
										class="btn btn-success btn-sm">
										<i class="fa fa-plus"></i> 新增
									</button>
								</p:btn>
							</div>
							<table id="mgrid2" data-url="">
								<thead>
									<tr>
										<th data-checkbox="true"></th>
										<th data-formatter="MGrid.indexfn" data-align="center"
											data-width="30px">序号</th>
										<th data-field="ctSchool">校院</th>
										<th data-field="schNum">校院人数</th>
										<th data-field="avgSch">校院个人费用</th>
										<th data-field="ctItems">费用名目</th>
										<th data-field="ctMoney">费用金额</th>
										<th data-field="ctDate" data-formatter="MGrid.getTimeDD">领款日期</th>
										<th data-field="ctPayee">领款人</th>
										<th data-field="ctDept">领款部门</th>
										<th data-field="ctRemark">备注</th>
										<th data-align="center" data-width="180px" data-field="ctId"
											data-formatter="buidOperate">操作</th>
									</tr>
								</thead>
							</table>
						</div>
						<!-- 选项卡内容 end -->
					</div>
				</div>

				<!-- 这是第三个选项卡的内容 -->
				<div id="tab-3" class="tab-pane">
					<div class="panel-body">
						<!-- 选项卡内容 end -->
						<div class="ibox-content">
							<!-- 搜索框部分start -->
							<p:btn value="serch">
								<form class="form-inline" id="serchform3">

									<div class="form-group mr-20 ">
										<label for="exampleInputName2">费用名目</label> <input
											class="form-control" name="ctItems" type="text">
									</div>

									<div class="form-group mr-20 ">
										<label for="exampleInputName2">领款人</label> <input
											class="form-control" name="ctPayee" type="text">
									</div>

									<label for="exampleInputName2">领款部门</label>
									<div class="form-group mr-20">
										<select name="ctDept" class="form-control autoFull select2"
											data-url="${path}/admin/userinfo/queryAllDepart"
											data-def="${obj.ctDept }" data-filed="name" data-value="name"
											datatype="*" nullmsg="部门不能为空">
											<option value="">--请选择所属部门--</option>
										</select>
										<div class="Validform_checktip"></div>
									</div>

									<br />
									<br />

									<div class="form-group mr-20">
										<label for="exampleInputName2">入学时间</label> <input
											name="beginTime" id="beginTime" type="text"
											class="form-control datetimepicker">— <input
											name="endTime" id="endTime" type="text"
											class="form-control datetimepicker">
									</div>
									
									<button onclick="myGrid3.serchData()" type="button"
										class="btn btn-info btn-sm">
										<i class="fa fa-search "></i> 搜索
									</button>
									<button type="button" onclick="MForm.reset('#serchform3')"
										class="btn btn-info btn-sm">
										<i class="fa fa-refresh "></i> 重置
									</button>
								</form>
							</p:btn>
							<!-- 搜索框部分en -->
							<div class="option-bar">
								<p:btn value="dels">
									<button onclick="myGrid3.delItems('ctId')" type="button"
										class="btn btn-danger btn-sm">
										<i class="fa fa-trash"></i>批量删除
									</button>
								</p:btn>
								<p:btn value="add">
									<button onclick="openAdd()" type="button"
										class="btn btn-success btn-sm">
										<i class="fa fa-plus"></i> 新增
									</button>
								</p:btn>
							</div>
							<table id="mgrid3" data-url="">
								<thead>
									<tr>
										<th data-checkbox="true"></th>
										<th data-formatter="MGrid.indexfn" data-align="center"
											data-width="30px">序号</th>
										<th data-field="num">在读人数</th>
										<th data-field="avgNum">个人费用</th>
										<th data-field="ctItems">费用名目</th>
										<th data-field="ctMoney">费用金额</th>
										<th data-field="ctDate" data-formatter="MGrid.getTimeDD">领款日期</th>
										<th data-field="ctPayee">领款人</th>
										<th data-field="ctDept">领款部门</th>
										<th data-field="ctRemark">备注</th>
										<th data-align="center" data-width="180px" data-field="ctId"
											data-formatter="buidOperate">操作</th>
									</tr>
								</thead>
							</table>
						</div>
						<!-- 选项卡内容 end -->
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>



	<script type="text/javascript">
		var myGrid;
		var myGrid2;
		var myGrid3;
		$(function() {
			//带搜索的下拉框
			$(".select2").select2({
				'width' : '100%'
			});
			$(".select2").trigger("blur");
			//初始化下拉框
			MTools.autoFullSelect();
			//初始化日期控件
			MTools.ininDatetimepicker({
				listenBlur : true
			});
			//有删除权限
			var delUrl = "";
			<p:btn value="dels">
			delUrl = "${path}/admin/costRegister/del";
			</p:btn>

			myGrid = MGrid.initGrid({
				url : "${path}/admin/costRegister/showList",
				delUrl : delUrl,
				tableSelecter : "#mgrid1",// 表格选择器 请保持唯一
				serchFormSelecter : "#serchform1",// 搜索表单选择器
			});

			//调出院校登记列表
			myGrid2 = MGrid.initGrid({
				url : "${path}/admin/costRegister/showList",
				delUrl : delUrl,
				tableSelecter : "#mgrid2",// 表格选择器 请保持唯一
				serchFormSelecter : "#serchform2",// 搜索表单选择器
			});

			//调出个人费用登记列表
			myGrid3 = MGrid.initGrid({
				url : "${path}/admin/costRegister/showList",
				delUrl : delUrl,
				tableSelecter : "#mgrid3",// 表格选择器 请保持唯一
				serchFormSelecter : "#serchform3",// 搜索表单选择器
			});
		});
		function buidOperate(value, row, index) {
			var html = '';
			<p:btn value="edit">
			html += '<button class="btn btn-default btn-sm mr-5" onClick="openEdit('
					+ value
					+ ')"  title="编辑"><i class="fa fa-edit"></i></buttoun>'
			</p:btn>
			<p:btn value="del">
			html += '<button class="btn btn-default btn-sm" onClick="myGrid.delItem('
					+ value
					+ ')" title="删除"><i class="fa fa-lg fa-trash-o"></i></buttoun>';
			</p:btn>
			html += ''
			return html;
		}
		//打开添加界面
		<p:btn value="add">
		function openAdd() {
			layer.open({
				type : 2,
				title : "添加信息",
				area : [ MUI.SIZE_L, '500px' ],
				content : [ '${path}/admin/costRegister/editForm' ]
			});
		}
		</p:btn>

		//打开编辑界面
		<p:btn value="edit">
		function openEdit(id) {
			console.log(id);
			layer.open({
				type : 2,
				title : "编辑费用登记",
				area : [ MUI.SIZE_L, '500px' ],
				maxmin : true,
				content : [ '${path}/admin/costRegister/editForm?id=' + id ]
			});
		}
		</p:btn>

		//弹出导入数据的页面
		<p:btn value="import">
		function openImport() {
			//弹出修改框
			layer.open({
				type : 2,
				title : "批量导入",
				area : [ MUI.SIZE_L, '300px' ],
				maxmin : true,
				content : [ '${path}/admin/redirect/courseImportDialog' ]
			});
		}
		</p:btn>

		/* 导出excel */
		<p:btn value="export">
		function exportExcel() {
			var couName = $("#couName").val();
			var couCost = $("#couCost").val();
			window.location.href = "${path}/admin/course/exportExcel?couName="
					+ couName + "&couCost=" + couCost;
		}
		</p:btn>
	</script>
</body>
</html>
